from .models import Article
from django import forms
from django.forms import widgets

class ArticleModelForm(forms.ModelForm):

    class Meta:
        model = Article
        fields = ["title",'category',"tags","body"]


    def __init__(self,*args,**kwargs):
        super().__init__(*args,**kwargs)
        for filed in self.fields.values():
            filed.error_messages = {"required": "该字段不能为空"}
            filed.widget.attrs.update({"class": "form-control"})



